﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LogDispControl
{
    public class LogLineList
    {
        public List<LogLine> LogLines = new List<LogLine>();
        public long SelectedLineID;
        public Color SelectedLineColor;
        public Rectangle SelectedRectancle;
        private long lineID = 0;
        public PointF BasePointF = new PointF(0, 0);
        //internal PointF lastposition = new PointF(0, 0);
        public float FontSize = 20f;
        public int MaxCount = 100;
        public void Addline(Color color, string content)
        {
            LogLine logLine = new LogLine();
            logLine.Content = content;
            logLine.LineColor = color;
            logLine.LineID = getlineid();
            LogLines.Add(logLine);
            if (LogLines.Count > MaxCount)
            {
                LogLines.RemoveAt(0);
            }
           // lastposition = new PointF(0, rectangleF.Y + rectangleF.Height);
        }

        object obj_getline = new object();
        private long getlineid()
        {
            lock (obj_getline)
            {
                lineID++;
                if (lineID == 10000000)
                {
                    lineID = 0;
                }
            }
            return lineID;
        }
    }

    public struct LogLine
    {
        public long LineID;
        public string Content;
        public Color LineColor;
    }
}
